package com.ruoyi.ruoyixingyue.modules.api.controller;


import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.page.PageData;
import com.ruoyi.ruoyixingyue.modules.api.po.CatalogueDetailPo;
import com.ruoyi.ruoyixingyue.modules.api.po.CourseCatalogueListPo;
import com.ruoyi.ruoyixingyue.modules.api.po.CourseListPo;
import com.ruoyi.ruoyixingyue.modules.api.service.ICourseCatalogueService;
import com.ruoyi.ruoyixingyue.modules.api.vo.CatagueInsertVo;
import com.ruoyi.ruoyixingyue.modules.api.vo.CourseCatalogueListVo;
import com.ruoyi.ruoyixingyue.modules.api.vo.CourseListVo;
import com.ruoyi.ruoyixingyue.modules.utils.Condition;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 章节表 前端控制器
 * </p>
 *
 * @author lzz
 * @since 2024-02-24
 */
@RestController
@RequestMapping("/courseCatalogue")
public class CourseCatalogueController {

    @Autowired
    private ICourseCatalogueService courseCatalogueService;

    @ApiOperation("课程章节类型list")
    @PostMapping("/courseCatalogue/list/API_001")
    public R<PageData<CourseCatalogueListPo>> courseCatalogueListAPI_001(@RequestBody Condition<CourseCatalogueListVo> condition) {
        return courseCatalogueService.courseCatalogueListAPI_001(condition);
    }

    @ApiOperation("课程章节字典")
    @PostMapping("/courseCatalogue/dict/API_002")
    public R<List> courseCatalogueDictAPI_002() {
        return courseCatalogueService.courseCatalogueDictAPI_002();
    }

    @ApiOperation("根据课程获取章节")
    @PostMapping("/courseCatalogue/getPidByType/API_003/{courseId}")
    public R<List> pidDictAPI_003(@PathVariable("courseId") Long courseId) {
        return courseCatalogueService.PidDictAPI_003(courseId);
    }

    @ApiOperation("新增章节")
    @PostMapping("/courseCatalogue/insert/API_004")
    public R<String> catagueInsertAPI_004(@RequestBody CatagueInsertVo catagueInsertVo) {
        return courseCatalogueService.catagueInsertAPI_004(catagueInsertVo);
    }

    @ApiOperation("删除章节")
    @PostMapping("/courseCatalogue/delete/API_005/{id}")
    public R<String> catagueDeleteAPI_005(@PathVariable("id") Long id) {
        return courseCatalogueService.catagueDeleteAPI_005(id);
    }

    @ApiOperation("根据id获取章节信息")
    @PostMapping("/courseCatalogue/getById/API_006/{id}")
    public R<CatalogueDetailPo> cataguegetByIdAPI_006(@PathVariable("id") Long id) {
        return courseCatalogueService.cataguegetByIdAPI_006(id);
    }

}
